<template>
  <view style="margin-top: 50rpx">
    <u-cell-group :border="false" style="background-color:#fff;border-radius: 20rpx;margin-bottom: 20rpx;">
      <u-cell title="领金币音效" size="large" :border="false">
        <view slot="value">
          <u-switch v-model="value" @change="change" size="50" activeColor="#F73728"></u-switch>
        </view>
      </u-cell>
    </u-cell-group>
  </view>
</template>
<script>
export default {
  name: "msgSet",
  data(){
    return {
      value: uni.getStorageSync('msg') === 1 // 1 开启 2 关闭
    }
  },
  methods: {
    change(value){
      this.value = value
      uni.setStorageSync('msg',value ? 1 : 2)
    }
  },
  onShow(){
    if(uni.getStorageSync('msg') === null){
      uni.setStorageSync('msg',1)
    }
    this.value = uni.getStorageSync('msg') === 1
  }
}
</script>

<style>
page{
  background: #f5f5f5;
}
</style>
<style scoped lang="scss">

</style>
